<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false" %>
<%@ page import="java.util.*"%>
<%@ page import="java.io.File"%>


<html>
<head>
<title>Home</title>
</head>


<link rel="stylesheet" href="<c:url value="/resources/css/selectCsv.css"/>" />

<!-- jquery -->
<script
	src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script
	src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<!--  local js-->
<script type="text/javascript"
	src="<c:url value="/resources/js/selectCsv.js" />"></script>


<body>

<%
	File filepath=new File("C:\\Users\\dwu102\\jboss-as-7.0.1.Final\\standalone\\tmp\\tmpFiles");
	File[] sourceFileList = filepath.listFiles();
%>
<div id="select">
	<div id="selectFile">
		<form method="POST" action="selectFile" enctype="multipart/form-data" style="display:none;">
        	File to select: <input type="file" name="file"><br /> 
        	<input type="submit" value="Upload"> Press here to upload the file!
		</form>
		<table class="table table-striped table-bordered">
			<tr>
			<th>fileName</th>
			<th>view</th>
			<th>select</th>
			</tr>
			<%
				if (sourceFileList != null) {
					int i=0;
					for (File fileName : sourceFileList) {
						i=i+1;
			%>
			<tr>
				<td><%=fileName.getName()%></td>
				<td><input type="button" name="<%="viewbutton"+i%>" id="<%="viewButton"+i%>" value='viewCsv' /></td>
				<td><input type="checkbox" name="<%="selectButton"+i%>" /></td>
			</tr>
			<%
					}
				}
			%>
			
		</table>
	</div>
	
	<div id="review">
		<table border=1>
		<c:forEach items="${head}" var="item">
	          <td><c:out value="${item}" /><td>         
	    </c:forEach>
		 <c:forEach items="${content}" var="item1">
	        <tr>
	         <c:forEach items="${item1}" var="t1">
	          <td><c:out value="${t1}" /><td>
	         </c:forEach>
	        </tr>
	      </c:forEach>
		</table>
		<div>
		<input type="button" name="returnback"  id="back" value='return back' />
		</div>
	</div>
	
	
</div>




</body>
</html>